<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core">
  <ui:composition template="/shopTemplate.xhtml">
       
        <ui:define name="content">
        
        	<h:commandButton actionListener="#{bikesListBean.showAllBikes}" value="#{msg['bikes.filter.all']}">
    			<f:ajax render="bikesTable"  />
  			</h:commandButton>
  			
  			<h:commandButton actionListener="#{bikesListBean.showDiscountBikes}" value="#{msg['bikes.filter.discount']}">
    			<f:ajax render="bikesTable"  />
  			</h:commandButton>
  			
  			<br/>
  			<br/>

       		<h:dataTable id="bikesTable" value="#{bikesListBean.bikesList}" var="b">
                  <h:column>
                      <f:facet name="header" >
                          <h:outputText value="#{msg['bikes.list.name']}" />
                      </f:facet>    
                      <h:outputText value="#{b.name}"/>
                  </h:column>
                  <h:column>
                      <f:facet name="header" >
                          <h:outputText value="#{msg['bikes.list.price']}"/>
                      </f:facet>    
                      <h:outputText value="#{b.price}"/>
                  </h:column>
                  <h:column>
                      <f:facet name="header" >
                          <h:outputText value="#{msg['bikes.list.discountprice']}"/>
                      </f:facet>    
                      <h:outputText value="#{b.discountPrice}" rendered="#{b.discountPrice!=null}"/>
                      <h:outputText value="--" rendered="#{!(b.discountPrice!=null)}"/>
                  </h:column>
                  <h:column>
                      <f:facet name="header" >
                          <h:outputText value="#{msg['bikes.list.details']}"/>
                      </f:facet>    
                      <h:button outcome="bikeDetails" value="#{msg['bikes.list.seebike']}">
                       	<f:param name="bikeId" value="#{b.id}"/>
                      </h:button>
                  </h:column>
              </h:dataTable>

        </ui:define>

  </ui:composition>
</html>
